package com.hh.mads.ui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.hh.core.XDADService;
import com.hh.core.ad.XDActivityIconView;
import com.hh.core.listener.XDRewardActivityIconListener;
import com.hh.mads.R;

import androidx.annotation.Nullable;

/**
 * Created by YuHong on 2020/8/16 0016.
 */
public class LunchActivity extends Activity {

    private  LinearLayout linearLayout;
    private boolean isShow;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.aty_lunch);
        initView();
    }

    private void initView() {
        linearLayout = findViewById(R.id.ll_info);

    }


    public void toMain(View v){
        startActivity(new Intent(this,MainActivity.class));
    }


    public void showIcon(View v){
        XDActivityIconView activityIconView = new XDActivityIconView(this,linearLayout);
        activityIconView.setActivityIconListener(new XDRewardActivityIconListener() {
            @Override
            public void onFail(String msg) {
                Toast.makeText(LunchActivity.this,msg,Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onShow() {
//                Toast.makeText(LunchActivity.this,"show",Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onClick() {
                Toast.makeText(LunchActivity.this,"click",Toast.LENGTH_SHORT).show();
            }
        });
        if(!isShow) {
            activityIconView.loadRewardActivityIcon();
            isShow = true;
            ((TextView)v).setText("隐藏素材");
        }else {
            activityIconView.closeIcon();
            isShow = false;
            ((TextView)v).setText("显示素材");
        }
    }
}
